package Game01;

public class GameClass01 {
    private String name;
    private String gender;
    private int age;
    private int HP;


    public GameClass01() {
    }

    public GameClass01(String name, String gender, int age, int HP) {
        this.name = name;
        if (gender == "男" || gender == "女") {
            this.gender = gender;
        } else {
            System.out.printf("%s,性别参数错误", this.getName());
        }
        if (age > 0 && age < 100) {
            this.age = age;
        } else {
            System.out.printf("%s，年龄设置有误", this.getName());
        }

        this.HP = HP;
    }

    /**
     * 获取
     *
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     *
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     *
     * @return gender
     */
    public String getGender() {
        return gender;
    }

    /**
     * 设置
     *
     * @param gender
     */
    public void setGender(String gender) {
        this.gender = gender;
    }

    /**
     * 获取
     *
     * @return age
     */
    public int getAge() {
        return age;
    }

    /**
     * 设置
     *
     * @param age
     */
    public void setAge(int age) {
        this.age = age;
    }

    /**
     * 获取
     *
     * @return HP
     */
    public int getHP() {
        return HP;
    }

    /**
     * 设置
     *
     * @param HP
     */
    public void setHP(int HP) {
        this.HP = HP;
    }

    public String toString() {
        return "英雄数据{姓名 = " + name + ", 性别 = " + gender + ", 年龄 = " + age + ", HP = " + HP + "}";
    }
}
